pub fn clean(manifest_path: &Path, opts: &CleanOptions) -> CargoResult<()> {
let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
opts.config));
- try!(src.update());
let root = try!(src.root_package());
let target_dir = opts.config.target_dir(&root);
let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(),
options.config));
- try!(source.update());
-
// TODO: Move this into PathSource
let package = try!(source.root_package());
debug!("loaded package; package={}", package);
use std::process::Command;
use core::PackageIdSpec;
-use core::source::Source;
use ops;
use sources::PathSource;
use util::{CargoResult, human};
options: &DocOptions) -> CargoResult<()> {
let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(),
options.compile_opts.config));
- try!(source.update());
let package = try!(source.root_package());
let mut lib_names = HashSet::new();
pub fn fetch(manifest_path: &Path, config: &Config) -> CargoResult<()> {
let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(source.update());
let package = try!(source.root_package());
let mut registry = PackageRegistry::new(config);
use core::PackageId;
use core::registry::PackageRegistry;
-use core::{Source, Resolve, SourceId};
+use core::{Resolve, SourceId};
use core::resolver::Method;
use ops;
use sources::{PathSource};
-> CargoResult<()> {
let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(source.update());
let package = try!(source.root_package());
let mut registry = PackageRegistry::new(config);
registry.preload(package.package_id().source_id(), Box::new(source));
opts: &UpdateOptions) -> CargoResult<()> {
let mut source = try!(PathSource::for_path(manifest_path.parent().unwrap(),
opts.config));
- try!(source.update());
let package = try!(source.root_package());
let previous_resolve = match try!(ops::load_pkg_lockfile(&package)) {
use flate2::{GzBuilder, Compression};
use flate2::read::GzDecoder;
-use core::{Source, SourceId, Package, PackageId};
+use core::{SourceId, Package, PackageId};
use sources::PathSource;
use util::{self, CargoResult, human, internal, ChainError, Config};
use ops;
metadata: bool) -> CargoResult<Option<PathBuf>> {
let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(src.update());
let pkg = try!(src.root_package());
if metadata {
use std::path::Path;
use ops;
-use core::{Source, PackageIdSpec};
+use core::{PackageIdSpec};
use sources::{PathSource};
use util::{CargoResult, human, Config};
config: &Config) -> CargoResult<PackageIdSpec> {
let mut source = try!(PathSource::for_path(&manifest_path.parent().unwrap(),
config));
- try!(source.update());
let package = try!(source.root_package());
let lockfile = package.root().join("Cargo.lock");
use ops::{self, ExecEngine, CompileFilter};
use util::{self, CargoResult, human, process, ProcessError};
-use core::source::Source;
use sources::PathSource;
pub fn run(manifest_path: &Path,
let config = options.config;
let mut src = try!(PathSource::for_path(&manifest_path.parent().unwrap(),
config));
- try!(src.update());
let root = try!(src.root_package());
let mut bins = root.manifest().targets().iter().filter(|a| {
verify: bool) -> CargoResult<()> {
let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(src.update());
let pkg = try!(src.root_package());
let (mut registry, reg_id) = try!(registry(config, token, index));
let manifest_path = try!(find_root_manifest_for_cwd(None));
let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(src.update());
let pkg = try!(src.root_package());
pkg.name().to_string()
}
let manifest_path = try!(find_root_manifest_for_cwd(None));
let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
config));
- try!(src.update());
let pkg = try!(src.root_package());
pkg.name().to_string()
}
}
}
- pub fn root_package(&self) -> CargoResult<Package> {
+ pub fn root_package(&mut self) -> CargoResult<Package> {
trace!("root_package; source={:?}", self);
- if !self.updated {
- return Err(internal("source has not been updated"))
- }
+ try!(self.update());
match self.packages.iter().find(|p| p.root() == &*self.path) {
Some(pkg) => Ok(pkg.clone()),